#include <stdio.h>

int main() {
    int a, b, c, d, e;
    scanf("%d %d", &a, &b);
    int arr[a];
    for (c = 0; c < a; c++) {
        scanf("%d", &arr[c]);
    }
    
    for (c = 0; c < b; c++) {
        for (d = 0; d < a - 1 - c; d++) {
            if (arr[d] > arr[d + 1]) {
                e = arr[d];
                arr[d] = arr[d + 1];
                arr[d + 1] = e;
            }
        }
    }
    
    for (c = 0; c < a; c++) {
        if (c > 0) {
            printf(" ");
        }
        printf("%d", arr[c]);
    }
    printf("\n");
    return 0;
}
